import Vue from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';
import { directivesExt } from '@/lib/directives.js';

import '@/utils/HxmTable/HxmTable.js';
import '@/utils/HxmTable/hxmTable.less';

Vue.use(window.hxmui, {
  componentsConfig: {
    PickerWheel: {
      BScroll,
    },
  },
});
// 注册全局组件
Vue.use(window.hxmui, { projectName: 'advancedStockPool' });
Vue.use(window._Components.StockList);
Vue.use(window._Components.StockListItem);

// 添加全局指令
Vue.directive('hxm-redgreen', {
  bind(el, binding) {
    setTimeout(() => {
      directivesExt.redgreenhandler(el, binding);
    }, 30);
  },
  componentUpdated(el, binding) {
    setTimeout(() => {
      directivesExt.redgreenhandlerUpdate(el, binding);
    }, 50);
  },
});
Vue.config.productionTip = false;

Vue.config.errorHandler = error => {
  window.ClientMonitor.reportFrameErrors(
    {
      category: 'js', // 类型
      grade: 'Warning', // 级别
    },
    error
  );
};
new Vue({
  router,
  store,
  render: h => h(App),
}).$mount('#app');
